#include "AniSaver.h"

AniSaver::AniSaver(std::ostream &s) : s(s)
{
}

AniSaver::~AniSaver(void)
{
}

void AniSaver::SaveAnimationStart()
{
}

void AniSaver::SaveAnimationEnd()
{
	StreamWriter::WriteByte(s, 66);
}

void AniSaver::SaveAnimationPresent()
{
	StreamWriter::WriteByte(s, 1);
}

void AniSaver::SaveAnimationNotPresent()
{
	StreamWriter::WriteByte(s, 0);
}

void AniSaver::SaveStartNodes(int nodesCount)
{
	StreamWriter::WriteInt(s, nodesCount);
}

void AniSaver::SaveEndNodes()
{
}

void AniSaver::SaveStartNode(int nodeId)
{
	StreamWriter::WriteInt(s, nodeId);
}

void AniSaver::SaveEndNode()
{
}

void AniSaver::SavePositionBeginSection(int keysCount)
{
	StreamWriter::WriteByte(s, 1); //AnimationType::Position
	StreamWriter::WriteInt(s, keysCount);
}

void AniSaver::SavePositionKey(float time, float x, float y, float z)
{
	StreamWriter::WriteFloat(s, time);
	StreamWriter::WriteFloat(s, x);
	StreamWriter::WriteFloat(s, y);
	StreamWriter::WriteFloat(s, z);
}

void AniSaver::SavePositionEndSection()
{
}

void AniSaver::SaveRotationBeginSection(int keysCount)
{
	StreamWriter::WriteByte(s, 2); //AnimationType::Rotation
	StreamWriter::WriteInt(s, keysCount);
}

void AniSaver::SaveRotationKey(float time, float a, float x, float y, float z)
{
	StreamWriter::WriteFloat(s, time);
	StreamWriter::WriteFloat(s, a);
	StreamWriter::WriteFloat(s, x);
	StreamWriter::WriteFloat(s, y);
	StreamWriter::WriteFloat(s, z);
}

void AniSaver::SaveRotationEndSection()
{
}

void AniSaver::SaveScaleBeginSection(int keysCount)
{
	StreamWriter::WriteByte(s, 3); //AnimationType::Scale
	StreamWriter::WriteInt(s, keysCount);
}

void AniSaver::SaveScaleKey(float time, float x, float y, float z)
{
	StreamWriter::WriteFloat(s, time);
	StreamWriter::WriteFloat(s, x);
	StreamWriter::WriteFloat(s, y);
	StreamWriter::WriteFloat(s, z);
}

void AniSaver::SaveScaleEndSection()
{
}

void AniSaver::SaveRollBeginSection(int keysCount)
{
	StreamWriter::WriteByte(s, 4); //AnimationType::Float
	StreamWriter::WriteInt(s, keysCount);
}

void AniSaver::SaveRollKey(float time, float v)
{
	StreamWriter::WriteFloat(s, time);
	StreamWriter::WriteFloat(s, v);
}

void AniSaver::SaveRollEndSection()
{
}

void AniSaver::SaveLocalTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SaveObjectTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SaveWorldTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SaveInverseLocalTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SaveInverseObjectTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SaveInverseWorldTransformMatrix(float *v)
{
	StreamWriter::WriteBuffer(s, v, sizeof(float) * 4 * 4);
}

void AniSaver::SavePivotPoint(float x, float y, float z)
{
	StreamWriter::WriteFloat(s, x);
	StreamWriter::WriteFloat(s, y);
	StreamWriter::WriteFloat(s, z);
}
